package com.zsy.text.to.phone.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zsy.text.to.phone.service.TextService;

@Controller
public class TextController {

    @Resource
    private TextService textService;

    @RequestMapping("/index")
    public String index() {
        return "index";
    }

    @RequestMapping("/text")
    @ResponseBody
    public String getText() {
        return textService.getCurText();
    }

    @PostMapping("/insert/text")
    @ResponseBody
    public void insertText(@ModelAttribute("text") String text) {
        System.out.println(text);
        textService.insertText(text);
    }

}
